package main

import "fmt"

//无参方法
func greet() {
	fmt.Println("no param")
}

//有参方法
func greet0(name string) {
	fmt.Println(name)
}

//多参方法
func greet1(name string, age int) {
	fmt.Println("name :", name, "  age: ", age)
}

//又返回的方法
func greet2(name string) string {
	return "hello " + name
}

//返回多值方法
func greet3(name string) (string, int) {
	return name, 12
}

//不定参数
func greet4(name string, score ...int) {
	fmt.Println("name is ", name)
	for i, v := range score {
		fmt.Println("index=", i, " value= ", v)
	}
}

//main function
func main() {
	greet()
	greet0("zhangsan")
	greet1("zhangsan", 12)
	fmt.Println(greet2("zhangsan"))
	name, age := greet3("wangwu")
	fmt.Println("name is ", name, "age is ", age)

	greet4("wangwu", 23, 43, 34, 2342, 435, 56, 543)
	scores := []int{23, 43, 34, 2342, 435, 56, 543}
	greet4("wangwu", scores...)

}
